// 使用示例
loadScript('https://static-game.flash.cn/h5/sdk/v1.0.4.js', function(err) {
    if (err) {
        console.error('加载出错');
    } else {
        console.log('加载成功');
        // 在这里使用加载的库
        // 登录
        flash2144_login();
        console.log("是否打开游戏：",open_game);
    }
});

function flash2144_login(){
    var queryParams = getQueryParams();
    console.log(queryParams);
    queryParams.cid = cid;
    queryParams.gid = gid;
    faXingLogin(queryParams);
}

function getQueryParams() {
    var urlParams = new URLSearchParams(window.location.search);
    var params = {};
    for (var param of urlParams.entries()) {
        params[param[0]] = param[1];
    }
    return params;
}



function flash2144_creterole(data){
    var queryParams = getQueryParams();
    var user_id = queryParams.user_id;

    var role = {
        user_id: user_id,
        game_key: extdata.Appkey,
        server_id: data.sid,
    };
    // 进入游戏
    hGame.gamevisit(role);
    role.role_id = data.role_id;
    role.role_name = data.role_name;
    console.log("2144角色数据：",role);
    hGame.role(role,function (result){
        console.log("2144创建角色",result);
    });

}



function flash2144_pay(data){
    console.log("2144支付数据：",data);
    hGame.pay(data,function (){
        console.log("2144发起支付");
    });
}
